<%@ page language="java" pageEncoding="UTF-8"
	contentType="text/html; charset=UTF-8"%>
		<%@ include file="include/taglib.jsp"%>
<%@ include file="modules/sys/include/inhead.jsp"%> 
<script type="text/javascript">
	$(function() {
		$("#submit").click(function() {
			var arg = $.parseJSON($('#argjson').val());
			//var arg = {hsqdList:"[{\"reportno\":\"123\"},{\"reportno\":\"124\"}]"};
			var url = $('#jsonurl').val();
			//var arg = {"account":"dsy","password":"1234","type":"2"};
			//var url = 'http://localhost:8080/zzld_syhs/loginapp';
			$.ajax({
				url : 'http://localhost:8080/zzld_syhs/' + url,
				data : arg,
				dataType : 'json',
				type : 'post',
				success : function(response) {
					alert("返回的json字符串:" + jsonToStr(response));
				},
				error : function(response) {
					alert('出现错误！');
				},
			});
		});
	});

	/** 
	 * json对象转字符串形式 
	 */
	function jsonToStr(o) {
		var arr = [];
		var fmt = function(s) {
			if (typeof s == 'object' && s != null)
				return jsonToStr(s);
			return /^(string|number)$/.test(typeof s) ? "'" + s + "'" : s;
		}
		for ( var i in o)
			arr.push("'" + i + "':" + fmt(o[i]));
		return '{' + arr.join(',') + '}';
	}
</script>
<h2>接口测试!</h2>
查询参数字符串:
<input id='argjson' type='text' style="width: 500px;" />
<br />
请求控制器地址:
<input id='jsonurl' type='text' style="width: 500px;" />
<br />
<input id='submit' type='button' value='查询' />